package com.donleo.ssm.service.impl;

import com.donleo.ssm.dao.ICodeMapper;
import com.donleo.ssm.model.CodeModel;
import com.donleo.ssm.service.ICodeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * @author liangd
 * date 2020-11-24 10:43
 * code
 */
@Service("codeService")
public class CodeServiceImpl implements ICodeService {

    @Resource
    private ICodeMapper codeMapper;

    @Override
    public Integer add(CodeModel codeModel) {
        codeModel.setCreateTime(new Date());
        return codeMapper.add(codeModel);
    }

    @Override
    public Integer delete(Integer id) {
        return codeMapper.delete(id);
    }

    @Override
    public Integer deletes(List<Integer> idList) {
        return codeMapper.deletes(idList);
    }

    @Override
    public Integer update(CodeModel codeModel) {
        codeModel.setUpdateTime(new Date());
        return codeMapper.update(codeModel);
    }

    @Override
    public CodeModel findById(Integer id) {
        return codeMapper.findById(id);
    }

    @Override
    public List<CodeModel> findAll(CodeModel codeModel) {
        return codeMapper.findAll(codeModel);
    }

    @Override
    public Integer getCount(CodeModel codeModel) {
        return codeMapper.getCount(codeModel);
    }

    @Override
    public List<CodeModel> findByType(String type) {
        return codeMapper.findByType(type);
    }

}
